import request from '@/utils/request'
import service from "./axios-config";
import domain from "./domain.js"
export default{
	//登录
	login(username, password) {
	    return request({
	        url: '/user/login',
	        method: 'post',
	        data:{
				username,
				password
			}
	      })
	},
	//获取用户信息
	getInfo(token) {
	    return new Promise((resolve, reject) => {
	        return service({
	            url: "/user/getInfo",
	            method: "get",
	            params: { token }
	        })
	            .then(response => {
	                resolve(response);
	            })
	            .catch(error => {
	                reject(error);
	            });
	    });
	},
	//退出登录
	logout(token) {
	    return new Promise((resolve, reject) => {
	        return service({
	            url: "/user/logout",
	            method: "post"
	        })
	            .then(response => {
	                resolve(response);
	            })
	            .catch(error => {
	                reject(error);
	            });
	    });
	}
}